package com.sgb.jicai.view.adapter;

import android.content.Context;

import com.sgb.jicai.BR;
import com.sgb.jicai.R;
import com.sgb.jicai.entity.FactoryCentralizedItemEntity;
import com.swgk.core.recyclerview.adapter.BaseRecycleAdapter;
import com.swgk.core.recyclerview.adapter.ItemViewHolder;

import java.util.List;

public class FactoryCentralizedListItemChildAdapter extends BaseRecycleAdapter<FactoryCentralizedItemEntity.ProductSaleSlipDetails> {

    public FactoryCentralizedListItemChildAdapter(Context context, List<FactoryCentralizedItemEntity.ProductSaleSlipDetails> datas) {
        super(context, R.layout.item_factory_centralized_list_child, datas);
    }

    @Override
    public void convert(ItemViewHolder holder, final FactoryCentralizedItemEntity.ProductSaleSlipDetails entity) {
        holder.setBinding(BR.viewModel, entity);
    }

    @Override
    public int getItemCount() {
        if (getDatas() != null && getDatas().size() > 0) {
            return Math.min(getDatas().size(), 3);
        }
        return 0;
    }
}